
//- This Source Code Form is subject to the terms of the Mozilla Public
//- License, v. 2.0. If a copy of the MPL was not distributed with this
//- file, You can obtain one at http://mozilla.org/MPL/2.0/.
//-
//- Copyright (c) 2021-present Kaleidos Ventures SL

doctype html

div.wrapper.roles(ng-controller="RolesController as ctrl",
                        ng-init="section='admin'", tg-roles)
    tg-project-menu

    sidebar.menu-secondary.sidebar.settings-nav(tg-admin-navigation="roles")
        include ../includes/modules/admin-menu

    sidebar.menu-tertiary.sidebar
        include ../includes/modules/admin-submenu-roles

    section.main.admin-roles.admin-common
        header.header-with-actions
            include ../includes/components/mainTitle
            .action-buttons(ng-if="!role.external_user")
                button.btn-small(
                    variant="destructive"
                    title="{{'COMMON.DELETE' | translate}}",
                    ng-click="ctrl.delete()")
                    span(translate="COMMON.DELETE")


        tg-edit-role(ng-if="!role.external_user")
            .edit-role
                input(type="text", value="{{ role.name }}")
                a.save(href="", title="{{'COMMON.SAVE' | translate}}")
                    tg-svg(svg-icon="icon-save")
            p.total
                span.role-name(title="{{'ADMIN.ROLES.COUNT_MEMBERS' | translate}}") {{ role.name }}
                a.edit-value(href="")
                    tg-svg(svg-icon="icon-edit")

        div(ng-if="role.external_user")
            p.total
                span.role-name {{ role.name }}

        div.any-computable-role(ng-hide="anyComputableRole", translate="ADMIN.ROLES.WARNING_NO_ROLE")

        div.general-category.external-user(ng-if="role.external_user")
            span(translate="ADMIN.ROLES.NOTE_EXTERNAL_USERS")

        div.general-category(ng-if="!role.external_user")
            span(translate="ADMIN.ROLES.HELP_ROLE_ENABLED")
            div.check
                input(type="checkbox", ng-model="role.computable", ng-change="ctrl.toggleComputable()")
                div
                span.check-text.check-yes(translate="COMMON.YES")
                span.check-text.check-no(translate="COMMON.NO")

        div(tg-role-permissions, ng-model="role")
